home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_libpcap.idb / usr / freeware / catman / p_man / cat3 / pcap.Z / pcap
Encoding:
Text File  |  1999-04-16  |  19.8 KB  |  265 lines

  1.  
  2.  
  3.  
  4.      PPPPCCCCAAAAPPPP((((3333))))           UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((22224444 JJJJuuuunnnneeee 1111999999998888))))           PPPPCCCCAAAAPPPP((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       pcap - Packet    Capture    library
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.       ####iiiinnnncccclllluuuuddddeeee <<<<ppppccccaaaapppp....hhhh>>>>
  13.  
  14.       ppppccccaaaapppp____tttt ****ppppccccaaaapppp____ooooppppeeeennnn____lllliiiivvvveeee((((cccchhhhaaaarrrr ****ddddeeeevvvviiiicccceeee,,,, iiiinnnntttt ssssnnnnaaaapppplllleeeennnn,,,,
  15.           iiiinnnntttt pppprrrroooommmmiiiisssscccc,,,, iiiinnnntttt ttttoooo____mmmmssss,,,, cccchhhhaaaarrrr ****eeeebbbbuuuuffff))))
  16.       ppppccccaaaapppp____tttt ****ppppccccaaaapppp____ooooppppeeeennnn____oooofffffffflllliiiinnnneeee((((cccchhhhaaaarrrr ****ffffnnnnaaaammmmeeee,,,, cccchhhhaaaarrrr ****eeeebbbbuuuuffff))))
  17.       ppppccccaaaapppp____dddduuuummmmppppeeeerrrr____tttt    ****ppppccccaaaapppp____dddduuuummmmpppp____ooooppppeeeennnn((((ppppccccaaaapppp____tttt ****pppp,,,, cccchhhhaaaarrrr    ****ffffnnnnaaaammmmeeee))))
  18.  
  19.       cccchhhhaaaarrrr eeeerrrrrrrrbbbbuuuuffff[[[[PPPPCCCCAAAAPPPP____EEEERRRRRRRRBBBBUUUUFFFF____SSSSIIIIZZZZEEEE]]]];;;;
  20.       cccchhhhaaaarrrr ****ppppccccaaaapppp____llllooooooookkkkuuuuppppddddeeeevvvv((((cccchhhhaaaarrrr ****eeeerrrrrrrrbbbbuuuuffff))))
  21.       iiiinnnntttt ppppccccaaaapppp____llllooooooookkkkuuuuppppnnnneeeetttt((((cccchhhhaaaarrrr ****ddddeeeevvvviiiicccceeee,,,, bbbbppppffff____uuuu____iiiinnnntttt33332222 ****nnnneeeettttpppp,,,,
  22.           bbbbppppffff____uuuu____iiiinnnntttt33332222 ****mmmmaaaasssskkkkpppp,,,, cccchhhhaaaarrrr ****eeeerrrrrrrrbbbbuuuuffff))))
  23.  
  24.       iiiinnnntttt ppppccccaaaapppp____ddddiiiissssppppaaaattttcccchhhh((((ppppccccaaaapppp____tttt ****pppp,,,, iiiinnnntttt ccccnnnntttt,,,,
  25.           ppppccccaaaapppp____hhhhaaaannnnddddlllleeeerrrr ccccaaaallllllllbbbbaaaacccckkkk,,,, uuuu____cccchhhhaaaarrrr    ****uuuusssseeeerrrr))))
  26.       iiiinnnntttt ppppccccaaaapppp____lllloooooooopppp((((ppppccccaaaapppp____tttt ****pppp,,,, iiiinnnntttt ccccnnnntttt,,,,
  27.           ppppccccaaaapppp____hhhhaaaannnnddddlllleeeerrrr ccccaaaallllllllbbbbaaaacccckkkk,,,, uuuu____cccchhhhaaaarrrr    ****uuuusssseeeerrrr))))
  28.       vvvvooooiiiidddd ppppccccaaaapppp____dddduuuummmmpppp((((uuuu____cccchhhhaaaarrrr    ****uuuusssseeeerrrr,,,, ssssttttrrrruuuucccctttt ppppccccaaaapppp____ppppkkkktttthhhhddddrrrr ****hhhh,,,,
  29.           uuuu____cccchhhhaaaarrrr ****sssspppp))))
  30.  
  31.       iiiinnnntttt ppppccccaaaapppp____ccccoooommmmppppiiiilllleeee((((ppppccccaaaapppp____tttt ****pppp,,,, ssssttttrrrruuuucccctttt bbbbppppffff____pppprrrrooooggggrrrraaaammmm ****ffffpppp,,,,
  32.           cccchhhhaaaarrrr ****ssssttttrrrr,,,, iiiinnnntttt ooooppppttttiiiimmmmiiiizzzzeeee,,,, bbbbppppffff____uuuu____iiiinnnntttt33332222 nnnneeeettttmmmmaaaasssskkkk))))
  33.       iiiinnnntttt ppppccccaaaapppp____sssseeeettttffffiiiilllltttteeeerrrr((((ppppccccaaaapppp____tttt ****pppp,,,,    ssssttttrrrruuuucccctttt bbbbppppffff____pppprrrrooooggggrrrraaaammmm ****ffffpppp))))
  34.  
  35.       uuuu____cccchhhhaaaarrrr ****ppppccccaaaapppp____nnnneeeexxxxtttt((((ppppccccaaaapppp____tttt ****pppp,,,, ssssttttrrrruuuucccctttt ppppccccaaaapppp____ppppkkkktttthhhhddddrrrr ****hhhh))))
  36.  
  37.       iiiinnnntttt ppppccccaaaapppp____ddddaaaattttaaaalllliiiinnnnkkkk((((ppppccccaaaapppp____tttt ****pppp))))
  38.       iiiinnnntttt ppppccccaaaapppp____ssssnnnnaaaappppsssshhhhooootttt((((ppppccccaaaapppp____tttt ****pppp))))
  39.       iiiinnnntttt ppppccccaaaapppp____iiiissss____sssswwwwaaaappppppppeeeedddd((((ppppccccaaaapppp____tttt ****pppp))))
  40.       iiiinnnntttt ppppccccaaaapppp____mmmmaaaajjjjoooorrrr____vvvveeeerrrrssssiiiioooonnnn((((ppppccccaaaapppp____tttt    ****pppp))))
  41.       iiiinnnntttt ppppccccaaaapppp____mmmmiiiinnnnoooorrrr____vvvveeeerrrrssssiiiioooonnnn((((ppppccccaaaapppp____tttt    ****pppp))))
  42.       iiiinnnntttt ppppccccaaaapppp____ssssttttaaaattttssss((((ppppccccaaaapppp____tttt    ****pppp,,,, ssssttttrrrruuuucccctttt ppppccccaaaapppp____ssssttttaaaatttt ****ppppssss))))
  43.       FFFFIIIILLLLEEEE ****ppppccccaaaapppp____ffffiiiilllleeee((((ppppccccaaaapppp____tttt ****pppp))))
  44.       iiiinnnntttt ppppccccaaaapppp____ffffiiiilllleeeennnnoooo((((ppppccccaaaapppp____tttt ****pppp))))
  45.       vvvvooooiiiidddd ppppccccaaaapppp____ppppeeeerrrrrrrroooorrrr((((ppppccccaaaapppp____tttt ****pppp,,,, cccchhhhaaaarrrr ****pppprrrreeeeffffiiiixxxx))))
  46.       cccchhhhaaaarrrr ****ppppccccaaaapppp____ggggeeeetttteeeerrrrrrrr((((ppppccccaaaapppp____tttt ****pppp))))
  47.       cccchhhhaaaarrrr ****ppppccccaaaapppp____ssssttttrrrreeeerrrrrrrroooorrrr((((iiiinnnntttt eeeerrrrrrrroooorrrr))))
  48.  
  49.       vvvvooooiiiidddd ppppccccaaaapppp____cccclllloooosssseeee((((ppppccccaaaapppp____tttt ****pppp))))
  50.       vvvvooooiiiidddd ppppccccaaaapppp____dddduuuummmmpppp____cccclllloooosssseeee((((ppppccccaaaapppp____dddduuuummmmppppeeeerrrr____tttt ****pppp))))
  51.  
  52.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  53.       The Packet Capture library provides a    high level interface
  54.       to packet capture systems. All packets on the    network, even
  55.       those    destined for other hosts, are accessible through this
  56.       mechanism.
  57.  
  58.      RRRROOOOUUUUTTTTIIIINNNNEEEESSSS
  59.       ppppccccaaaapppp____ooooppppeeeennnn____lllliiiivvvveeee(((()))) is used to obtain a packet capture
  60.  
  61.  
  62.  
  63.      Page 1                          (printed 2/3/99)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      PPPPCCCCAAAAPPPP((((3333))))           UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((22224444 JJJJuuuunnnneeee 1111999999998888))))           PPPPCCCCAAAAPPPP((((3333))))
  71.  
  72.  
  73.  
  74.       descriptor to    look at    packets    on the network.     _d_e_v_i_c_e    is a
  75.       string that specifies    the network device to open.  _s_n_a_p_l_e_n
  76.       specifies the    maximum    number of bytes    to capture.  _p_r_o_m_i_s_c
  77.       specifies if the interface is    to be put into promiscuous
  78.       mode.     (Note that even if this parameter is false, the
  79.       interface could well be in promiscuous mode for some other
  80.       reason.)  _t_o__m_s specifies the    read timeout in    milliseconds.
  81.       _e_b_u_f is used to return error text and    is only    set when
  82.       ppppccccaaaapppp____ooooppppeeeennnn____lllliiiivvvveeee(((()))) fails and returns NNNNUUUULLLLLLLL.
  83.  
  84.       ppppccccaaaapppp____ooooppppeeeennnn____oooofffffffflllliiiinnnneeee(((()))) is called    to open    a ``savefile'' for
  85.       reading.  _f_n_a_m_e specifies the    name of    the file to open. The
  86.       file has the same format as those used by ttttccccppppdddduuuummmmpppp((((1111)))) and
  87.       ttttccccppppsssslllliiiicccceeee((((1111)))).    The name "-" in    a synonym for ssssttttddddiiiinnnn.  _e_b_u_f is
  88.       used to return error text and    is only    set when
  89.       ppppccccaaaapppp____ooooppppeeeennnn____oooofffffffflllliiiinnnneeee(((()))) fails and    returns    NNNNUUUULLLLLLLL.
  90.  
  91.       ppppccccaaaapppp____dddduuuummmmpppp____ooooppppeeeennnn(((()))) is called to    open a ``savefile'' for
  92.       writing. The name "-"    in a synonym for ssssttttddddoooouuuutttt.  NNNNUUUULLLLLLLL is
  93.       returned on failure.    _p is a _p_c_a_p struct as returned by
  94.       ppppccccaaaapppp____ooooppppeeeennnn____oooofffffffflllliiiinnnneeee(((()))) or ppppccccaaaapppp____ooooppppeeeennnn____lllliiiivvvveeee(((()))).  _f_n_a_m_e specifies
  95.       the name of the file to open.     If NNNNUUUULLLLLLLL is returned,
  96.       ppppccccaaaapppp____ggggeeeetttteeeerrrrrrrr(((())))    can be used to get the error text.
  97.  
  98.       ppppccccaaaapppp____llllooooooookkkkuuuuppppddddeeeevvvv(((()))) returns a pointer to    a network device
  99.       suitable for use with    ppppccccaaaapppp____ooooppppeeeennnn____lllliiiivvvveeee(((()))) and ppppccccaaaapppp____llllooooooookkkkuuuuppppnnnneeeetttt(((()))).
  100.       If there is an error,    NNNNUUUULLLLLLLL is    returned and _e_r_r_b_u_f is filled
  101.       in with with an appropriate error message.
  102.  
  103.       ppppccccaaaapppp____llllooooooookkkkuuuuppppnnnneeeetttt(((()))) is used to determine    the network number and
  104.       mask associated with the network device ddddeeeevvvviiiicccceeee.  Both    _n_e_t_p
  105.       and _m_a_s_k_p are    _b_p_f__u__i_n_t_3_2 pointers.  A return    of -1
  106.       indicates an error in    which case _e_r_r_b_u_f is filled in with
  107.       with an appropriate error message.
  108.  
  109.       ppppccccaaaapppp____ddddiiiissssppppaaaattttcccchhhh(((()))) is used to collect and process packets.  _c_n_t
  110.       specifies the    maximum    number of packets to process before
  111.       returning. A _c_n_t of -1 processes all the packets received in
  112.       one buffer. A    _c_n_t of 0 processes all packets until an    error
  113.       occurs, EEEEOOOOFFFF is reached, or the read times out    (when doing
  114.       live reads and a non-zero read timeout is specified).
  115.       _c_a_l_l_b_a_c_k specifies a routine to be called with three
  116.       arguments:  a    _u__c_h_a_r pointer which is    passed in from
  117.       ppppccccaaaapppp____ddddiiiissssppppaaaattttcccchhhh(((()))), a pointer to    the _p_c_a_p__p_k_t_h_d_r    struct (which
  118.       precede the actual network headers and data),    and a _u__c_h_a_r
  119.       pointer to the packet    data. The number of packets read is
  120.       returned.  Zero is returned when EEEEOOOOFFFF is reached in a
  121.       ``savefile.''    A return of -1 indicates an error in which
  122.       case ppppccccaaaapppp____ppppeeeerrrrrrrroooorrrr(((()))) or    ppppccccaaaapppp____ggggeeeetttteeeerrrrrrrr(((()))) may be used to display
  123.       the error text.
  124.  
  125.       ppppccccaaaapppp____dddduuuummmmpppp(((()))) outputs a    packet to the ``savefile'' opened with
  126.  
  127.  
  128.  
  129.      Page 2                          (printed 2/3/99)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      PPPPCCCCAAAAPPPP((((3333))))           UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((22224444 JJJJuuuunnnneeee 1111999999998888))))           PPPPCCCCAAAAPPPP((((3333))))
  137.  
  138.  
  139.  
  140.       ppppccccaaaapppp____dddduuuummmmpppp____ooooppppeeeennnn(((()))).  Note that its calling arguments are
  141.       suitable for use with    ppppccccaaaapppp____ddddiiiissssppppaaaattttcccchhhh(((()))).
  142.  
  143.       ppppccccaaaapppp____ccccoooommmmppppiiiilllleeee(((()))) is used to compile the    string _s_t_r into    a
  144.       filter program.  _p_r_o_g_r_a_m is a    pointer    to a _b_p_f__p_r_o_g_r_a_m
  145.       struct and is    filled in by ppppccccaaaapppp____ccccoooommmmppppiiiilllleeee(((()))).  _o_p_t_i_m_i_z_e
  146.       controls whether optimization    on the resulting code is
  147.       performed.  _n_e_t_m_a_s_k specifies    the netmask of the local net.
  148.  
  149.       ppppccccaaaapppp____sssseeeettttffffiiiilllltttteeeerrrr(((()))) is used to specify a    filter program.     _f_p is
  150.       a pointer to an array    of _b_p_f__p_r_o_g_r_a_m struct, usually the
  151.       result of a call to ppppccccaaaapppp____ccccoooommmmppppiiiilllleeee(((()))).  ----1111 is returned on
  152.       failure; 0000 is    returned on success.
  153.  
  154.       ppppccccaaaapppp____lllloooooooopppp(((()))) is similar to ppppccccaaaapppp____ddddiiiissssppppaaaattttcccchhhh(((()))) except it keeps
  155.       reading packets until    _c_n_t packets are    processed or an    error
  156.       occurs.  It does nnnnooootttt return when live    read timeouts occur.
  157.       Rather, specifying a non-zero    read timeout to
  158.       ppppccccaaaapppp____ooooppppeeeennnn____lllliiiivvvveeee(((()))) and then calling ppppccccaaaapppp____ddddiiiissssppppaaaattttcccchhhh(((()))) allows the
  159.       reception and    processing of any packets that arrive when the
  160.       timeout occurs.  A negative _c_n_t causes ppppccccaaaapppp____lllloooooooopppp(((()))) to    loop
  161.       forever (or at least until an    error occurs).
  162.  
  163.       ppppccccaaaapppp____nnnneeeexxxxtttt(((()))) returns a    _u__c_h_a_r pointer to the next packet.
  164.  
  165.       ppppccccaaaapppp____ddddaaaattttaaaalllliiiinnnnkkkk(((()))) returns the link layer type, e.g.
  166.       DDDDLLLLTTTT____EEEENNNN11110000MMMMBBBB.
  167.  
  168.       ppppccccaaaapppp____ssssnnnnaaaappppsssshhhhooootttt(((()))) returns the snapshot length specified    when
  169.       ppppccccaaaapppp____ooooppppeeeennnn____lllliiiivvvveeee was called.
  170.  
  171.       ppppccccaaaapppp____iiiissss____sssswwwwaaaappppppppeeeedddd(((()))) returns true if the    current    ``savefile''
  172.       uses a different byte    order than the current system.
  173.  
  174.       ppppccccaaaapppp____mmmmaaaajjjjoooorrrr____vvvveeeerrrrssssiiiioooonnnn(((()))) returns the major number    of the version
  175.       of the pcap used to write the    savefile.
  176.  
  177.       ppppccccaaaapppp____mmmmiiiinnnnoooorrrr____vvvveeeerrrrssssiiiioooonnnn(((()))) returns the minor number    of the version
  178.       of the pcap used to write the    savefile.
  179.  
  180.       ppppccccaaaapppp____ffffiiiilllleeee(((()))) returns the name of the ``savefile.''
  181.  
  182.       iiiinnnntttt ppppccccaaaapppp____ssssttttaaaattttssss(((()))) returns 0 and fills in a ppppccccaaaapppp____ssssttttaaaatttt struct.
  183.       The values represent packet statistics from the start    of the
  184.       run to the time of the call. If there    is an error or the
  185.       under    lying packet capture doesn't support packet
  186.       statistics, -1 is returned and the error text    can be
  187.       obtained with    ppppccccaaaapppp____ppppeeeerrrrrrrroooorrrr(((()))) or ppppccccaaaapppp____ggggeeeetttteeeerrrrrrrr(((()))).
  188.  
  189.       ppppccccaaaapppp____ffffiiiilllleeeennnnoooo(((())))    returns    the file descriptor number of the
  190.       ``savefile.''
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                          (printed 2/3/99)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      PPPPCCCCAAAAPPPP((((3333))))           UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((22224444 JJJJuuuunnnneeee 1111999999998888))))           PPPPCCCCAAAAPPPP((((3333))))
  203.  
  204.  
  205.  
  206.       ppppccccaaaapppp____ppppeeeerrrrrrrroooorrrr(((())))    prints the text    of the last pcap library error
  207.       on ssssttttddddeeeerrrrrrrr, prefixed by _p_r_e_f_i_x.
  208.  
  209.       ppppccccaaaapppp____ggggeeeetttteeeerrrrrrrr(((())))    returns    the error text pertaining to the last
  210.       pcap library error.
  211.  
  212.       ppppccccaaaapppp____ssssttttrrrreeeerrrrrrrroooorrrr(((()))) is provided in case ssssttttrrrreeeerrrrrrrroooorrrr(1) isn't
  213.       available.
  214.  
  215.       ppppccccaaaapppp____cccclllloooosssseeee(((()))) closes the files    associated with    _p and
  216.       deallocates resources.
  217.  
  218.       ppppccccaaaapppp____dddduuuummmmpppp____cccclllloooosssseeee(((()))) closes the ``savefile.''
  219.  
  220.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  221.       tcpdump(1), tcpslice(1)
  222.  
  223.      AAAAUUUUTTTTHHHHOOOORRRRSSSS
  224.       Van Jacobson,    Craig Leres and    Steven McCanne,    all of the
  225.       Lawrence Berkeley National Laboratory, University of
  226.       California, Berkeley,    CA.
  227.  
  228.       The current version is available via anonymous ftp:
  229.  
  230.            _f_t_p://_f_t_p._e_e._l_b_l._g_o_v/_l_i_b_p_c_a_p._t_a_r._Z
  231.  
  232.      BBBBUUUUGGGGSSSS
  233.       Please send bug reports to libpcap@ee.lbl.gov.
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.      Page 4                          (printed 2/3/99)
  262.  
  263.  
  264.  
  265.